package main

import (
	"flag"
	"log"
	"os"
	"path/filepath"
)

import (
	"github.com/rocket049/pluginloader"
)

func main() {
	var con = flag.Bool("console", false, "run in console mode")
	flag.Parse()
	exe1, _ := os.Executable()
	dir1 := filepath.Dir(exe1)
	if *con {
		p, err := pluginloader.NewPluginLoader(filepath.Join(dir1, "plugins", "cui.so"))
		if err != nil {
			log.Println(err)
		} else {
			log.Println("console mode")
			p.Call("RunMain")
		}
	} else {
		p, err := pluginloader.NewPluginLoader(filepath.Join(dir1, "plugins", "gui.so"))
		if err != nil {
			log.Println(err)
		} else {
			p.Call("RunMain")
		}
	}
}
